import React, { useEffect, useState } from 'react'

export default function App() {
  const [count, setCount] = useState(0)
  const handleClick = () => {
    setCount(count + 1)
    // console.log(count)
  }

  useEffect(() => {
    // 初始化
    // 当 count 变化完毕后会走
    console.log(count)
  }, [count])
  return (
    <div>
      <h3>count: {count}</h3>
      <button onClick={handleClick}>+1</button>
    </div>
  )
}
